//
// Created by wenyaxi on 24-10-28.
//

#include "common.h"

class Data {
public:
    int id;
    int value;
    string name;

    friend ostream &operator<<(ostream &, const Data &);

    friend stringstream &operator<<(stringstream &, Data &);
};

ostream &operator<<(ostream &os, const Data &data) {
    os << "{" << data.id << ", " << data.value << ", " << data.name << "}" << endl;
    return os;
}

stringstream &operator<<(stringstream &sos, Data &data) {
    sos << "{" << data.id << ", " << data.value << ", " << data.name << "}" << endl;
    return sos;
}

int test() {
    clock_t begin = clock();
    Data data1{1, 1, "anna"};
    Data data2{2, 2, "mike"};
    Data data3{3, 3, "tom"};
    vector<Data> datas;
    datas.push_back(data1);
    datas.push_back(data2);
    datas.push_back(data3);

    auto p_data = ranges::find(datas, 2, &Data::id);
    vector<int> v{1, 2, 4, 56, 43, 5};
    auto borrowed_iterator = ranges::find(v, 3);
    clock_t end = clock();
    int time_spent = (end - begin);
    return time_spent;
}


mutex cout_mutex;

void test1(int i) {
    lock_guard<mutex> l(cout_mutex);
    std::cout << i << std::endl;
}

void func(int &&a) {
    cout << a << endl;
}

void test2() {
    int a = 10;
    cout << a << endl;
    int b = move(a);
    cout << a << endl;
}

int main() {
    auto generate_random_vector = Random::generate_random_vector(5, 100, true);
    cout << printer::int_array_to_string(generate_random_vector);
    return 0;
}
